package com.ghost.alibabaghost.api.model;

import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.util.Objects;

/**
 * 包： com.ghost.alibabaghost.api.model
 * 项目名称 alighost
 * @author yaolsa
 * 创建时间 2022/4/2 16:29
 * 描述：
 * Version 1.0
 */
public class TestEntity {

    @NotNull(message = "姓名不能为空")
    @Length(max = 3,message = "姓名长度不能为大于-3")
    private String name;

    private Integer age;
    private String hobby;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getHobby() {
        return hobby;
    }

    public void setHobby(String hobby) {
        this.hobby = hobby;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TestEntity that = (TestEntity) o;
        return Objects.equals(name, that.name) && Objects.equals(age, that.age) && Objects.equals(hobby, that.hobby);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age, hobby);
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("TestEntity{");
        sb.append("name='").append(name).append('\'');
        sb.append(", age=").append(age);
        sb.append(", hobby='").append(hobby).append('\'');
        sb.append('}');
        return sb.toString();
    }
}
